package com.lakala.bank
{
	import flash.display.Bitmap;
	import flash.display.DisplayObject;
	import flash.geom.Matrix;
	
	import org.aswing.Component;
	import org.aswing.GroundDecorator;
	import org.aswing.geom.IntRectangle;
	import org.aswing.graphics.BitmapBrush;
	import org.aswing.graphics.Graphics2D;
	import org.aswing.graphics.IBrush;

	public class MyBitmapDecorator implements GroundDecorator
	{
		//[Embed(source="asset/main_bg.png")]
		[Embed(source="asset/ColorBuble.png")]
		private var bgImg:Class;
		private var matrix:Matrix;
		private var repeat:Boolean;
		private var smooth:Boolean;

		public function MyBitmapDecorator(matrix:Matrix=null,repeat:Boolean=true,smooth:Boolean=false)
		{
		//	this.matrix=matrix;
			this.matrix=new Matrix();
			this.matrix.scale(2,2);
			this.repeat=repeat;
			this.smooth=smooth;
		}

		public function updateDecorator(c:Component, g:Graphics2D, b:IntRectangle):void
		{
			var bm:Bitmap=new bgImg()as Bitmap;
			var brush:IBrush=new BitmapBrush(bm.bitmapData,matrix,repeat,smooth);
			g.fillRectangle(brush,b.x,b.y,b.width,b.height);
		}

		public function getDisplay(c:Component):DisplayObject
		{
			return null;
		}
	}
}
